import("/lay/lib/jquery-3.4.1/jquery-3.4.1.min.js")



//ajax判断班级是否存在
function exitClass() {
    let className = $("#className").val();
    $.get("class/exitClass", {className: className}, function (result) {
        if (result.success == false) {
            $("#redmsg1").remove();
            $("#message1").append("<span id='redmsg1' style='color: red'>" + '*班级不存在*' + "</span>");
            $("#className").val("");
        } else {
            $("#redmsg1").remove();
        }
    })

}

//ajax判断老师是否存在
function checkTeacher() {
    let teacher = $("#teacherName").val();
    $.post("teacher/doesItExistTeacher",{name:teacher},function (result) {
        if (result == false) {
            $("#teachermsg").remove();
            $("#teacher").append("<span id='teachermsg' style='color: red'>" + '*教员不存在*' + "</span>");
            $("#teacherName").val("");
        }else {
            $("#teachermsg").remove();
        }
    })
}
//ajax判断老师是否存在
function checkLifeTeacher() {
    let teacher = $("#lifeTeacherName").val();
    $.post("teacher/doesItExistTeacher",{name:teacher},function (result) {
        if (result == false) {
            $("#lifeteachermsg").remove();
            $("#lifeTeacher").append("<span id='lifeteachermsg' style='color: red'>" + '*班主任不存在*' + "</span>");
            $("#lifeTeacherName").val("");
        }else {
            $("#lifeteachermsg").remove();
        }
    })
}


